-include mk.add

src = $(wildcard src/*.c)
obj = $(src:.c=.o)

lib_a = $(name).a
lib_so = $(name).$(so)

warn = -Wall -Wno-strict-aliasing

CC = gcc
CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(pic) -Isrc $(add_cflags)
LDFLAGS = $(add_ldflags)

.PHONY: all
all: $(lib_a) $(lib_so)

$(lib_a): $(obj)
	$(AR) rcs $@ $(obj)

$(lib_so): $(obj)
	$(CC) $(CFLAGS) $(shared) -o $@ $(obj) $(LDFLAGS)

.PHONY: clean
clean:
	rm -f $(obj)

.PHONY: distclean
distclean:
	rm -f $(obj) $(lib_a) $(lib_so) Makefile config.status
